package org.candy.core.convert.support;

import org.candy.core.convert.converter.Converter;

import java.io.ByteArrayInputStream;
import java.nio.charset.StandardCharsets;
import java.util.Properties;

public class StringToPropertiesConverter implements Converter<String, Properties> {
    public StringToPropertiesConverter() {
    }

    public Properties convert(String source) {
        try {
            Properties props = new Properties();
            props.load(new ByteArrayInputStream(source.getBytes(StandardCharsets.ISO_8859_1)));
            return props;
        } catch (Exception var3) {
            throw new IllegalArgumentException("Failed to parse [" + source + "] into Properties", var3);
        }
    }
}
